/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : structs_internal
	/// </summary>
	public class TestPOD1 : IPOD 
    {
        public readonly static Func<TestPOD1> FACTORY = () => new TestPOD1();
		public static Func<TestPOD1> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
        private List<string> m_sList;
		/// <summary>
        /// 
        /// </summary>
        private List<int> m_iList;
		/// <summary>
        /// 
        /// </summary>
        private List<float> m_fList;
		/// <summary>
        /// 
        /// </summary>
        private List<double> m_dList;
		/// <summary>
        /// 
        /// </summary>
        private List<long> m_lList;
		/// <summary>
        /// 
        /// </summary>
        private List<bool> m_bList;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, string> m_isMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, int> m_iiMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, float> m_ifMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, double> m_idMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, long> m_ilMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, bool> m_ibMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<string, int> m_siMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<float, int> m_fiMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<double, int> m_diMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<long, int> m_liMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<bool, int> m_biMap;
		/// <summary>
        /// 
        /// </summary>
		public TestPOD2 pod2;
		/// <summary>
        /// 
        /// </summary>
        private List<TestPOD2> m_pod2List;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<TestPOD2, int> m_pod2iMap;
		/// <summary>
        /// 
        /// </summary>
        private Dictionary<int, TestPOD2> m_ipod2Map;
		
		
        public List<string> sList
        {
            get
            {
                if(m_sList == null)
                {
                    m_sList = new();
                }
                return m_sList;
            }
            private set => m_sList = value;
        }
        public List<string> unsafe_sList
        {
        	get => m_sList;
        	set => m_sList = value;
        }
        public List<int> iList
        {
            get
            {
                if(m_iList == null)
                {
                    m_iList = new();
                }
                return m_iList;
            }
            private set => m_iList = value;
        }
        public List<int> unsafe_iList
        {
        	get => m_iList;
        	set => m_iList = value;
        }
        public List<float> fList
        {
            get
            {
                if(m_fList == null)
                {
                    m_fList = new();
                }
                return m_fList;
            }
            private set => m_fList = value;
        }
        public List<float> unsafe_fList
        {
        	get => m_fList;
        	set => m_fList = value;
        }
        public List<double> dList
        {
            get
            {
                if(m_dList == null)
                {
                    m_dList = new();
                }
                return m_dList;
            }
            private set => m_dList = value;
        }
        public List<double> unsafe_dList
        {
        	get => m_dList;
        	set => m_dList = value;
        }
        public List<long> lList
        {
            get
            {
                if(m_lList == null)
                {
                    m_lList = new();
                }
                return m_lList;
            }
            private set => m_lList = value;
        }
        public List<long> unsafe_lList
        {
        	get => m_lList;
        	set => m_lList = value;
        }
        public List<bool> bList
        {
            get
            {
                if(m_bList == null)
                {
                    m_bList = new();
                }
                return m_bList;
            }
            private set => m_bList = value;
        }
        public List<bool> unsafe_bList
        {
        	get => m_bList;
        	set => m_bList = value;
        }
        public Dictionary<int, string> isMap
        {
            get
            {
                if(m_isMap == null)
                {
                    m_isMap = new();
                }
                return m_isMap;
            }
            private set => m_isMap = value;
        }
        public Dictionary<int, string> unsafe_isMap
        {
        	get => m_isMap;
        	set => m_isMap = value;
        }
        public Dictionary<int, int> iiMap
        {
            get
            {
                if(m_iiMap == null)
                {
                    m_iiMap = new();
                }
                return m_iiMap;
            }
            private set => m_iiMap = value;
        }
        public Dictionary<int, int> unsafe_iiMap
        {
        	get => m_iiMap;
        	set => m_iiMap = value;
        }
        public Dictionary<int, float> ifMap
        {
            get
            {
                if(m_ifMap == null)
                {
                    m_ifMap = new();
                }
                return m_ifMap;
            }
            private set => m_ifMap = value;
        }
        public Dictionary<int, float> unsafe_ifMap
        {
        	get => m_ifMap;
        	set => m_ifMap = value;
        }
        public Dictionary<int, double> idMap
        {
            get
            {
                if(m_idMap == null)
                {
                    m_idMap = new();
                }
                return m_idMap;
            }
            private set => m_idMap = value;
        }
        public Dictionary<int, double> unsafe_idMap
        {
        	get => m_idMap;
        	set => m_idMap = value;
        }
        public Dictionary<int, long> ilMap
        {
            get
            {
                if(m_ilMap == null)
                {
                    m_ilMap = new();
                }
                return m_ilMap;
            }
            private set => m_ilMap = value;
        }
        public Dictionary<int, long> unsafe_ilMap
        {
        	get => m_ilMap;
        	set => m_ilMap = value;
        }
        public Dictionary<int, bool> ibMap
        {
            get
            {
                if(m_ibMap == null)
                {
                    m_ibMap = new();
                }
                return m_ibMap;
            }
            private set => m_ibMap = value;
        }
        public Dictionary<int, bool> unsafe_ibMap
        {
        	get => m_ibMap;
        	set => m_ibMap = value;
        }
        public Dictionary<string, int> siMap
        {
            get
            {
                if(m_siMap == null)
                {
                    m_siMap = new();
                }
                return m_siMap;
            }
            private set => m_siMap = value;
        }
        public Dictionary<string, int> unsafe_siMap
        {
        	get => m_siMap;
        	set => m_siMap = value;
        }
        public Dictionary<float, int> fiMap
        {
            get
            {
                if(m_fiMap == null)
                {
                    m_fiMap = new();
                }
                return m_fiMap;
            }
            private set => m_fiMap = value;
        }
        public Dictionary<float, int> unsafe_fiMap
        {
        	get => m_fiMap;
        	set => m_fiMap = value;
        }
        public Dictionary<double, int> diMap
        {
            get
            {
                if(m_diMap == null)
                {
                    m_diMap = new();
                }
                return m_diMap;
            }
            private set => m_diMap = value;
        }
        public Dictionary<double, int> unsafe_diMap
        {
        	get => m_diMap;
        	set => m_diMap = value;
        }
        public Dictionary<long, int> liMap
        {
            get
            {
                if(m_liMap == null)
                {
                    m_liMap = new();
                }
                return m_liMap;
            }
            private set => m_liMap = value;
        }
        public Dictionary<long, int> unsafe_liMap
        {
        	get => m_liMap;
        	set => m_liMap = value;
        }
        public Dictionary<bool, int> biMap
        {
            get
            {
                if(m_biMap == null)
                {
                    m_biMap = new();
                }
                return m_biMap;
            }
            private set => m_biMap = value;
        }
        public Dictionary<bool, int> unsafe_biMap
        {
        	get => m_biMap;
        	set => m_biMap = value;
        }
        public List<TestPOD2> pod2List
        {
            get
            {
                if(m_pod2List == null)
                {
                    m_pod2List = new();
                }
                return m_pod2List;
            }
            private set => m_pod2List = value;
        }
        public List<TestPOD2> unsafe_pod2List
        {
        	get => m_pod2List;
        	set => m_pod2List = value;
        }
        public Dictionary<TestPOD2, int> pod2iMap
        {
            get
            {
                if(m_pod2iMap == null)
                {
                    m_pod2iMap = new();
                }
                return m_pod2iMap;
            }
            private set => m_pod2iMap = value;
        }
        public Dictionary<TestPOD2, int> unsafe_pod2iMap
        {
        	get => m_pod2iMap;
        	set => m_pod2iMap = value;
        }
        public Dictionary<int, TestPOD2> ipod2Map
        {
            get
            {
                if(m_ipod2Map == null)
                {
                    m_ipod2Map = new();
                }
                return m_ipod2Map;
            }
            private set => m_ipod2Map = value;
        }
        public Dictionary<int, TestPOD2> unsafe_ipod2Map
        {
        	get => m_ipod2Map;
        	set => m_ipod2Map = value;
        }
		
		/*-- constructors --*/
		public TestPOD1() {}
		public TestPOD1(List<string> sList, List<int> iList, List<float> fList, List<double> dList, List<long> lList, List<bool> bList, Dictionary<int, string> isMap, Dictionary<int, int> iiMap, Dictionary<int, float> ifMap, Dictionary<int, double> idMap, Dictionary<int, long> ilMap, Dictionary<int, bool> ibMap, Dictionary<string, int> siMap, Dictionary<float, int> fiMap, Dictionary<double, int> diMap, Dictionary<long, int> liMap, Dictionary<bool, int> biMap, TestPOD2 pod2, List<TestPOD2> pod2List, Dictionary<TestPOD2, int> pod2iMap, Dictionary<int, TestPOD2> ipod2Map) {
			this.m_sList = sList;
			this.m_iList = iList;
			this.m_fList = fList;
			this.m_dList = dList;
			this.m_lList = lList;
			this.m_bList = bList;
			this.m_isMap = isMap;
			this.m_iiMap = iiMap;
			this.m_ifMap = ifMap;
			this.m_idMap = idMap;
			this.m_ilMap = ilMap;
			this.m_ibMap = ibMap;
			this.m_siMap = siMap;
			this.m_fiMap = fiMap;
			this.m_diMap = diMap;
			this.m_liMap = liMap;
			this.m_biMap = biMap;
			this.pod2 = pod2;
			this.m_pod2List = pod2List;
			this.m_pod2iMap = pod2iMap;
			this.m_ipod2Map = ipod2Map;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_list_string(m_sList); 
            _out.Write_list_int(m_iList); 
            _out.Write_list_float(m_fList); 
            _out.Write_list_double(m_dList); 
            _out.Write_list_long(m_lList); 
            _out.Write_list_boolean(m_bList); 
            _out.Write_map_int_string(m_isMap);
            _out.Write_map_int_int(m_iiMap);
            _out.Write_map_int_float(m_ifMap);
            _out.Write_map_int_double(m_idMap);
            _out.Write_map_int_long(m_ilMap);
            _out.Write_map_int_boolean(m_ibMap);
            _out.Write_map_string_int(m_siMap);
            _out.Write_map_float_int(m_fiMap);
            _out.Write_map_double_int(m_diMap);
            _out.Write_map_long_int(m_liMap);
            _out.Write_map_boolean_int(m_biMap);
            _out.Write_pod(pod2);
            _out.Write_list_pod(m_pod2List);
            _out.Write_map_pod_int(m_pod2iMap);
            _out.Write_map_int_pod(m_ipod2Map);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            m_sList = _in.Read_list_string();
            if(!_in.HasRemaining()) return;
            m_iList = _in.Read_list_int();
            if(!_in.HasRemaining()) return;
            m_fList = _in.Read_list_float();
            if(!_in.HasRemaining()) return;
            m_dList = _in.Read_list_double();
            if(!_in.HasRemaining()) return;
            m_lList = _in.Read_list_long();
            if(!_in.HasRemaining()) return;
            m_bList = _in.Read_list_boolean();
            if(!_in.HasRemaining()) return;
            m_isMap = _in.Read_map_int_string();
            if(!_in.HasRemaining()) return;
            m_iiMap = _in.Read_map_int_int();
            if(!_in.HasRemaining()) return;
            m_ifMap = _in.Read_map_int_float();
            if(!_in.HasRemaining()) return;
            m_idMap = _in.Read_map_int_double();
            if(!_in.HasRemaining()) return;
            m_ilMap = _in.Read_map_int_long();
            if(!_in.HasRemaining()) return;
            m_ibMap = _in.Read_map_int_boolean();
            if(!_in.HasRemaining()) return;
            m_siMap = _in.Read_map_string_int();
            if(!_in.HasRemaining()) return;
            m_fiMap = _in.Read_map_float_int();
            if(!_in.HasRemaining()) return;
            m_diMap = _in.Read_map_double_int();
            if(!_in.HasRemaining()) return;
            m_liMap = _in.Read_map_long_int();
            if(!_in.HasRemaining()) return;
            m_biMap = _in.Read_map_boolean_int();
            if(!_in.HasRemaining()) return;
            pod2 = _in.Read_pod<TestPOD2>(TestPOD2.DynamicFactory);
            if(!_in.HasRemaining()) return;
            m_pod2List = _in.Read_list_pod<TestPOD2>(TestPOD2.DynamicFactory);
            if(!_in.HasRemaining()) return;
            m_pod2iMap = _in.Read_map_pod_int<TestPOD2>(TestPOD2.DynamicFactory);
            if(!_in.HasRemaining()) return;
            m_ipod2Map = _in.Read_map_int_pod<TestPOD2>(TestPOD2.DynamicFactory);
        }
		
		public TestPOD1 Clone() {
            TestPOD1 o = DynamicFactory();
            if (m_sList != null) {
                o.m_sList = new (m_sList);
            }
            if (m_iList != null) {
                o.m_iList = new (m_iList);
            }
            if (m_fList != null) {
                o.m_fList = new (m_fList);
            }
            if (m_dList != null) {
                o.m_dList = new (m_dList);
            }
            if (m_lList != null) {
                o.m_lList = new (m_lList);
            }
            if (m_bList != null) {
                o.m_bList = new (m_bList);
            }
            if (m_isMap != null) {
                o.m_isMap = new (m_isMap);
            }
            if (m_iiMap != null) {
                o.m_iiMap = new (m_iiMap);
            }
            if (m_ifMap != null) {
                o.m_ifMap = new (m_ifMap);
            }
            if (m_idMap != null) {
                o.m_idMap = new (m_idMap);
            }
            if (m_ilMap != null) {
                o.m_ilMap = new (m_ilMap);
            }
            if (m_ibMap != null) {
                o.m_ibMap = new (m_ibMap);
            }
            if (m_siMap != null) {
                o.m_siMap = new (m_siMap);
            }
            if (m_fiMap != null) {
                o.m_fiMap = new (m_fiMap);
            }
            if (m_diMap != null) {
                o.m_diMap = new (m_diMap);
            }
            if (m_liMap != null) {
                o.m_liMap = new (m_liMap);
            }
            if (m_biMap != null) {
                o.m_biMap = new (m_biMap);
            }
            if (pod2 != null) {
                o.pod2 = pod2.Clone();
            }
            if (m_pod2List != null) {
                o.m_pod2List = m_pod2List.ConvertAll(o => o?.Clone());
            }
            if (m_pod2iMap != null) {
                o.m_pod2iMap = new ();
				m_pod2iMap.ToList().ForEach(kv => o.m_pod2iMap.Add(kv.Key?.Clone(), kv.Value));
            }
            if (m_ipod2Map != null) {
                o.m_ipod2Map = new ();
				m_ipod2Map.ToList().ForEach(kv => o.m_ipod2Map.Add(kv.Key, kv.Value?.Clone()));
            }
            return o;
        }
        
        public void Clear() {
            m_sList = default;
            m_iList = default;
            m_fList = default;
            m_dList = default;
            m_lList = default;
            m_bList = default;
            m_isMap = default;
            m_iiMap = default;
            m_ifMap = default;
            m_idMap = default;
            m_ilMap = default;
            m_ibMap = default;
            m_siMap = default;
            m_fiMap = default;
            m_diMap = default;
            m_liMap = default;
            m_biMap = default;
            pod2 = default;
            m_pod2List = default;
            m_pod2iMap = default;
            m_ipod2Map = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "TestPOD1 [";
			str += "sList=";
			str += m_sList.ToString<string>();
			str += ", iList=";
			str += m_iList.ToString<int>();
			str += ", fList=";
			str += m_fList.ToString<float>();
			str += ", dList=";
			str += m_dList.ToString<double>();
			str += ", lList=";
			str += m_lList.ToString<long>();
			str += ", bList=";
			str += m_bList.ToString<bool>();
			str += ", isMap=";
			str += m_isMap.ToString<int, string>();
			str += ", iiMap=";
			str += m_iiMap.ToString<int, int>();
			str += ", ifMap=";
			str += m_ifMap.ToString<int, float>();
			str += ", idMap=";
			str += m_idMap.ToString<int, double>();
			str += ", ilMap=";
			str += m_ilMap.ToString<int, long>();
			str += ", ibMap=";
			str += m_ibMap.ToString<int, bool>();
			str += ", siMap=";
			str += m_siMap.ToString<string, int>();
			str += ", fiMap=";
			str += m_fiMap.ToString<float, int>();
			str += ", diMap=";
			str += m_diMap.ToString<double, int>();
			str += ", liMap=";
			str += m_liMap.ToString<long, int>();
			str += ", biMap=";
			str += m_biMap.ToString<bool, int>();
			str += ", pod2=";
			str += pod2;
			str += ", pod2List=";
			str += m_pod2List.ToString<TestPOD2>();
			str += ", pod2iMap=";
			str += m_pod2iMap.ToString<TestPOD2, int>();
			str += ", ipod2Map=";
			str += m_ipod2Map.ToString<int, TestPOD2>();
			str += "]";
			return str;
		}
		
	}
}